<template>
  <div class="historybox bg">
    <h4 class="header ">7天运行统计</h4>
    <LineChart
      :chart-data="DefMonthOnAndRunTimeData"
      :height="'354px'"
      :str="str"
    ></LineChart>
  </div>
</template>

<script>
import LineChart from "../LineChart.vue";
export default {
  name: "index",
  props: {
    DefMonthOnAndRunTimeData: {
      type: Object,
      default: () => [],
    },
  },
  components: {
    LineChart,
  },

  data() {
    return {
      tabListNoTitle: [
        { key: "1", tab: "开机率" },
        { key: "2", tab: "运行时间" },
        { key: "3", tab: "故障时间" },
      ],
      noTitleKey: "1",
      chartData: {
        expectedData: [],
        date: [],
        name: ["开机时间", "运行时间"],
      },
      str: "小时",
    };
  },
  watch: {
    DefMonthOnAndRunTimeData(val) {
      return val;
      this.chartData = val;
      // this.DefMonthOnAndRunTimeDataIn(val)
    },
  },
  methods: {
    // DefMonthOnAndRunTimeDataIn(val){
    //    let workrate=[];
    //    let runtime=[]
    //   let date=[];
    //   //  测试数据
    //   this.Data.forEach(item=>{
    //     date.push(item.day);
    //     workrate.push(item.workrate);
    //     runtime.push(item.runtime)
    //   })
    //   this.chartData.expectedData=[];
    //   this.chartData.expectedData.push(workrate);
    //   this.chartData.expectedData.push(runtime);
    //   this.chartData.date=date
    // },
    onTabChange(key, type) {
      this[type] = key;
    },
  },
};
</script>

<style scoped lang="less">
@import "../../index.less";
</style>
